//
//  WJQStyleDarkCollectionViewCell.m
//  TripTogether
//
//  Created by dllo on 15/12/28.
//  Copyright © 2015年 王军岐. All rights reserved.
//

#import "WJQStyleDarkCollectionViewCell.h"

@interface WJQStyleDarkCollectionViewCell ()

@property (nonatomic, strong) UIImageView *imageV;
@property (nonatomic, strong) UILabel *titleL;
@property (nonatomic, strong) UILabel *subTitleL;

@end


@implementation WJQStyleDarkCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}
- (void)createSubView
{
    _imageV = [UIImageView new];
    _imageV.backgroundColor = [UIColor clearColor];
    _imageV.layer.masksToBounds = YES;
    _imageV.layer.cornerRadius = 4.f;
    _imageV.contentMode = UIViewContentModeScaleAspectFill;
    [self.contentView addSubview:_imageV];
    
    [_imageV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.edges.mas_equalTo(@0);
    }];
    
    UIView *backV = [UIView new];
    backV.backgroundColor = [UIColor colorWithRed:0.13 green:0.16 blue:0.17 alpha:1];
    backV.alpha = 0.5;
    backV.layer.masksToBounds = YES;
    backV.layer.cornerRadius = 4.f;
    [self.contentView addSubview:backV];
    
    [backV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.edges.mas_equalTo(_imageV);
    }];
    
    
    _titleL = [UILabel new];
    _titleL.backgroundColor = [UIColor clearColor];
    _titleL.textAlignment = NSTextAlignmentCenter;
    _titleL.textColor = [UIColor whiteColor];
    _titleL.font = [UIFont fontWithName:@"Bradley Hand" size:26.f];
    [self.contentView addSubview:_titleL];
    
    [_titleL mas_makeConstraints:^(MASConstraintMaker *make) {

        make.top.mas_equalTo(@((200 - 70) / 2.f));
        make.height.mas_equalTo(@40);
        
        make.width.mas_equalTo(self.contentView.mas_width);
        
    }];
    
    _subTitleL = [UILabel new];
    _subTitleL.backgroundColor = [UIColor clearColor];
    _subTitleL.textAlignment = NSTextAlignmentCenter;
    _subTitleL.textColor = [UIColor colorWithRed:0.93 green:0.93 blue:0.93 alpha:1];
    _subTitleL.font = [UIFont fontWithName:@"Gurmukhi MN" size:13.5f];
    [self.contentView addSubview:_subTitleL];
    
    [_subTitleL mas_updateConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_titleL.mas_bottom);
        make.left.mas_equalTo(@0);
        make.height.mas_equalTo(@30);
        make.width.mas_equalTo(self.contentView.mas_width);
    }];
    
    
}
- (void)setTripMod:(WJQTripModel *)tripMod
{
    [_imageV sd_setImageWithURL:[NSURL URLWithString:tripMod.cover] placeholderImage:PICHOLDEER];
    
    _titleL.text = tripMod.title;
    _subTitleL.text = [NSString stringWithFormat:@"「  %@  」", tripMod.sub_title];
}
@end
